import { toast } from '@/utils/common'
export function getDouBao(params) {
  return new Promise((resolve, reject) => {
    uni.request({
      url: "https://ark.cn-beijing.volces.com/api/v3/chat/completions", //仅为示例，并非真实接口地址。
      method: "POST",
      data: {
        model: "ep-20250728150431-52b2r",
        messages: [
          {
            role: "system",
            content:
              "你是测算助手，根据user提供的四柱八字结合大运流年，分析八字(baizi)，以此再推测出整体运势(overallFortune)、健康(health)、财富(wealth)、婚姻(marriage)、出行(travel)、穿搭(outfit)。总体字数控制在800字以内，按json格式返回,键为'()'里面的字母",
          },
          {
            role: "user",
            content: `四柱八字:${params.date}，大运${params.dayun}，流年${params.liunian}`,
          },
        ],
      },
      header: {
        Authorization: "Bearer db947b51-65ac-42b9-8632-ee9cfb682593",
      },
      success: (res) => {
        resolve(res.data)
      },
      fail: (err) => {
        toast('后端接口连接异常')
        reject('后端接口连接异常')
      }
    });
  });
}

// import OpenAI from "openai";
// export const openai = new OpenAI({
//   baseURL: "https://ark.cn-beijing.volces.com/api/v3/chat/completions",
//   apiKey: "db947b51-65ac-42b9-8632-ee9cfb682593",
//   dangerouslyAllowBrowser: true,
// });
// export async function deepSeek() {
//   const completion = await openai.chat.completions.create({
//     messages: [{ role: "system", content: "You are a helpful assistant." }],
//     model: "deepseek-chat",
//   });
//   console.log(completion.choices[0].message.content);
// }
